﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Code.Models;
using System.ComponentModel.DataAnnotations;

namespace Company.Web.Areas.Manage.Models.ManagerModels
{
    public class IndexModel
    {
        public IEnumerable<AdminItem> Admins { get; set; } 
    }

    public class AdminItem
    {
        public Guid ID { get; set; }
        public string LoginName { get; set; }
        public AdminState State { get; set; }
        public bool InLine { get; set; }
        public bool IsCurrent { get; set; }
    }
    
    [Comparison("ConfirmPwd","Password",ComparerOperator.Equal)]
    public class AdminEditModel
    {
        public bool IsNew { get; set; }
        public Guid? ID { get; set; }
        [Required(ErrorMessage="*")]
        public string LoginName { get; set; }
        [StringLength(20)]
        public string Password { get; set; }
        [CustomComparison(ComparerDataType.String,"Password",ComparerOperator.Equal,ErrorMessage="两次密码不一至")]
        public string ConfirmPwd { get; set; }
        [Required(ErrorMessage="请输入您的登陆密码")]
        public string CheckPwd { get; set; }

        public AdminState[] State { get { return (Enum.GetValues(typeof(AdminState)) as AdminState[]); } }
    }
}